# Maintainer:  Bartłomiej Piotrowski <bpiotrowski@archlinux.org>
# Contributor: Allan McRae <allan@archlinux.org>
# Contributor: judd <jvinet@zeroflux.org>

# NOTE: requires rebuilt with each new gcc version

# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
#  - noautobuild, !distcc
#  - removed multilib stuff
#  - patch for armv7h tests

noautobuild=1

pkgname=libtool
pkgver=2.4.6+44+gb9b44533
pkgrel=15
_gccver=10.2.0
pkgdesc='A generic library support script'
arch=(x86_64)
url='https://www.gnu.org/software/libtool'
license=(GPL)
groups=(base-devel)
depends=(sh tar glibc)
makedepends=("gcc>=$_gccver" git help2man)
checkdepends=(gcc-fortran)
provides=("libltdl=$pkgver")
conflicts=(libltdl)
replaces=(libltdl)
options=('!distcc')
_commit=b9b44533fbf7c7752ffd255c3d09cc360e24183b
source=(git+https://git.savannah.gnu.org/git/libtool.git#commit=$_commit
        git+https://git.savannah.gnu.org/git/gnulib.git
        gnulib-bootstrap::git+https://github.com/gnulib-modules/bootstrap.git
        no_hostname.patch
        armv7h-nopic.patch)
sha256sums=('SKIP'
            'SKIP'
            'SKIP'
            '693aabb24a6e7ce21fe0b5d14394e19edcb8476663b5afa4463f9fa0df24d946'
            '0e19dec2dabc958ef5d1bcfd0879174766c5783032319fc17d5d6692b2b397c8')

pkgver() {
  cd libtool
  git describe --tags | sed 's/-/+/g;s/^v//'
}

prepare() {
  cd libtool

  patch -Np1 -i ${srcdir}/no_hostname.patch

  git submodule init
  git config --local submodule.gnulib.url "$srcdir/gnulib"
  git config --local submodule.gl-mod/bootstrap.url "$srcdir/gnulib-bootstrap"
  git submodule update

  patch -p1 -i ../armv7h-nopic.patch
  ./bootstrap
}

build() {
  cd libtool
  ./configure --prefix=/usr lt_cv_sys_lib_dlsearch_path_spec="/usr/lib /usr/lib32"
  make
}

check() {
  cd libtool
  make check gl_public_submodule_commit=
}

package() {
  cd libtool
  make DESTDIR="$pkgdir" install
}
